<template>
	<view class="container">
		<view class="topbox">
			<image class="topbg" src="/static/img/tongzhi/tzbg.png" mode=""></image>
			<view class="topcon">
				<view class="toptitle">
					惠积分余额
				</view>
				<view class="qiannum">
					{{userinfo.pass||0}}
				</view>
			</view>
			
		</view>
		<view class="con">
			<view class="title">
				惠积分流水
			</view>
			<scroll-view scroll-y="true" class="scroll-view" @scrolltolower="scrolltolower">
				<view>
					<view class="minxitem" v-for="(item,index) in mxlist" :key="index">
						<image class="qian_icon" src="/static/img/tongzhi/zs1.png" mode=""></image>
						<view class="item_right">
							<view class="right_top">
								<text>{{item.username}}</text>
								<text style="color: #FA4600;font-size: 33rpx;">+{{item.value}}</text>
								<!-- <text v-if="item.abount==2" style="font-size: 33rpx;">-{{item.value}}</text> -->
							</view>
							<view class="time">
								{{item.createtime}}
							</view>
						</view>
					</view>
				</view>
				<u-loadmore :status="status" />
			</scroll-view>
			
		</view>
	</view>
</template>

<script>
	import {getPass} from '@/api/my.js'
	export default {
		data() {
			return {
				mxlist:[],
				page:1,
				status:'loadmore',
				last_page:0,
				userinfo:{}
			}
		},
		methods: {
			clickto(url){
				uni.$u.route(url);
			},
			scrolltolower(){
				this.page++
				if(this.page<=this.last_page){
					this.getlist()
				}else{
					this.status='nomore'
				}
			},
			getlist(){
				getPass({page:this.page}).then(res=>{
					// console.log(res)
					this.status='loadmore'
					this.last_page=res.data.data.last_page
					this.mxlist=[...this.mxlist,...res.data.data.data]
				})
			}
		},
		onLoad() {
			this.userinfo=uni.getStorageSync('userinfo')
			this.getlist()
		}
	}
</script>

<style lang="less">
.container{
	padding: 40rpx 30rpx 20rpx;
	.topbox{
		width: 690rpx;
		height: 205rpx;
		position: relative;
		color: #fff;
		.zzbox{
			position: absolute;
			width: 148rpx;
			line-height: 72rpx;
			background: #FFFFFF;
			border-radius: 36rpx;
			text-align: center;
			font-size: 30rpx;
			color: #F85909;
			top:70rpx;
			right: 44rpx;
		}
		.topbg{
			position: absolute;
			top: 0;
			left: 0;
			width: 690rpx;
			height: 205rpx;
		}
		.topcon{
			height: 282rpx;
			position: absolute;
			top: 0;
		}
		.toptitle{
			font-size: 24rpx;
			padding-top: 57rpx;
			padding-left: 47rpx;
			margin-bottom:20rpx;
		}
		.qiannum{
			font-size: 50rpx;
			font-weight: bold;
			padding-left: 46rpx;
		}
		.czbox{
			display: flex;
			align-items: center;
			justify-content: center;
			font-size: 32rpx;
			padding: 0 73rpx;
			.czline{
				width: 1rpx;
				height: 29rpx;
				background: #434A54;
				opacity: 0.2;
				margin: 0 76rpx;
			}
			.czicon{
				width: 42rpx;
				height: 42rpx;
				margin-right: 22rpx;
			}
			.box_item{
				display: flex;
				align-items: center;
			}
		}
	}
}
.title{
	font-size: 34rpx;
	color: #3F3F3F;
	font-weight: bold;
	margin-top: 44rpx;
	line-height: 40rpx;
}
.minxitem{
	display: flex;
	align-items: center;
	padding: 35rpx 0;
	border-bottom: 2rpx solid #DCDCDC;
	.qian_icon{
		width: 76rpx;
		height: 76rpx;
	}
	.item_right{
		padding-right: 20rpx;
		padding-left: 16rpx;
		flex: 1;
		display: flex;
		flex-direction: column;
		justify-content: center;
		
		.right_top{
			display: flex;
			justify-content: space-between;
			color: #333333;
			font-size: 26rpx;
			font-weight: bold;
			align-items: center;
		}
		.time{
			color: #A2A1A0;
			font-size: 24rpx;
		}
	}
}
.scroll-view{ 
	margin-top: 20rpx;
	height: calc(100vh - 40rpx - 44rpx - 205rpx - 40rpx - 20rpx - 44px - 20rpx);
	/* #ifdef MP */
	height: calc(100vh - 40rpx - 44rpx - 205rpx - 40rpx - 20rpx - 20rpx);
	/* #endif */
}
</style>
